package com.topisv.tms.repository.stock.preInstorage;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.stock.instorage.pre.InstorageBillItemPre;

/**
 * 预约入库DAO
 *  Date          Author       Version       Description
 * ----------------------------------------------------------
 *  2014-7-3      CC            1.0           Create
 */
public interface InstorageBillItemPreDao extends PagingAndSortingRepository<InstorageBillItemPre, Long>, JpaSpecificationExecutor<InstorageBillItemPre> {
	@Modifying
	@Query("delete InstorageBillItemPre t where t.billPreId=?")
	void deleteInstorageBillItemPre(Long id);
	
	@Query("select t from  InstorageBillItemPre t where t.billPreId=?")
	List<InstorageBillItemPre> query(Long id);
	
	@Query("select t from  InstorageBillItemPre t,InstorageBillPre p where t.billPreId=p.id and p.customerCode='MID' and t.billPreId=?1 and t.errorFlag='normal' ")
	List<InstorageBillItemPre> findByPreidAndError(Long id);
}
